-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BASW-131: Membership end date rules #6
base: 7.x-4.x
Are you sure you want to change the base?
Conversation
'value' => 0, | ||
'exposed_empty_option' => t('Automatic'), | ||
); | ||
$fields['membership_start_date_memberships'] = array ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe membership_start_date_rules_memberships is more clear, same for end_date_rules
includes/utils.inc
Outdated
'expose_list' => TRUE, | ||
'extra' => array('multiple' => 1), | ||
); | ||
$fields['membership_pro_rate_membership'] = array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this field is not related to the commit, it should not be here, and while it is fine for this PR, I think it is important to not do that when you open the PR against webform_civicrm core repo.
includes/utils.inc
Outdated
); | ||
$fields['membership_end_date_memberships'] = array ( | ||
'name' => t('Select Membership Types'), | ||
'type' => 'select', | ||
'expose_list' => TRUE, | ||
'extra' => array('multiple' => 1), | ||
); | ||
$fields['membership_pro_rate_membership'] = array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you removed this field on purpose ? or is it by mistake ?
@@ -984,6 +984,37 @@ class wf_crm_admin_form { | |||
} | |||
} | |||
} | |||
|
|||
// Pro rate price checkbox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be easy to move this logic to a new private method with a clear name ?
/** | ||
* Validate function for membership date rules. | ||
*/ | ||
public function validateMembershipDateRules() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for this to be public method
* Validate function for membership date rules. | ||
*/ | ||
public function validateMembershipDateRules() { | ||
if (!empty($this->data['membership'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or :
if (empty($this->data['membership'])) {
return;
}
// rest of the code
* @param Array $item | ||
* @return Float $price | ||
*/ | ||
private function pro_rated_membership_fee($type, $price, $c, $n, $item) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or change the method name to : caculateMembershipProRateFee
* @param Float $price | ||
* @param Integer $c | ||
* @param Array $item | ||
* @return Float $price |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the docblock params does not match the method params
* @param Array $item | ||
* @return Float $price | ||
*/ | ||
private function pro_rated_membership_fee($type, $price, $c, $n, $item) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you replace $c and $n and $item with names that represent what they actually about.
Overview:
In Webform/CiviCRM it is not possible
Solution:
This PR adds the functionality to